/*
 * Copyright 2013-2015 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.xdtech.trans.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.xdtech.trans.service.TransOrderTrackService;
import com.xdtech.trans.vo.TransOrderTrackItem;

/**
 * 
 * @author max.zheng
 * @create 2015-7-20下午10:00:27
 * @since 1.0
 * @see
 */
@Controller
@Scope("prototype")
public class TransPortalController {
	@Autowired
	private TransOrderTrackService transOrderTrackService;
	@RequestMapping(value="/transPortal.action",params = "index")
	public ModelAndView index() {
		return new ModelAndView("trans/portal/index_ftl");
	}
	
	@RequestMapping(value="/transPortal.action",params = "orderSearch")
	public ModelAndView orderSearch(HttpServletRequest request,String orders) {
		System.out.println(orders);
		request.setAttribute("orders", orders);
		List<TransOrderTrackItem> items = transOrderTrackService.loadTracksByOrderNos(orders);
		request.setAttribute("items", items);
		return new ModelAndView("trans/portal/orderSearch_ftl");
	}
	
	@RequestMapping(value="/transPortal.action",params = "websiteSearch")
	public ModelAndView websiteSearch(HttpServletRequest request,String website) {
		request.setAttribute("website", website);
		return new ModelAndView("trans/portal/websiteSearch_ftl");
	}
	
	@RequestMapping(value="/transPortal.action",params = "newInfo")
	public ModelAndView newInfo(HttpServletRequest request) {
		return new ModelAndView("trans/portal/newInfo_ftl");
	}
}
